package com.zx.map.service;
import com.zx.map.dao.model.MerchantCertificateInfo;
import com.zx.map.dao.model.MerchantInfo;
import com.zx.map.dao.model.MerchantInfoExample;
import com.zx.map.service.domain.MerchantInfoDomain;
import com.zx.map.service.domain.agent.TransAgentDomain;
import com.zx.map.service.model.*;
import org.springframework.dao.DataAccessException;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA. User: ������ Date: 15-5-12 Time: ����14:30 To
 * change this template use File | Settings | File Templates.
 */
public interface MerchantInfoService {
	
	
	public int unbind(String unbindId);
	
	public int bind(String selfId,String bindId);
	
	public int approve(String id,int approve);
	
	public List<MerchantInfo> getById(String id);
	
	public List<MerchantInfo> findByName(MerchantInfoModel model);
	
	public List<MerchantInfo> findByParent(String parentid);

	public boolean checkStoreInfoByMerchantId(String merchantId);
	/**
	 * 获取分店信息(包含所有子店)
	 * @param parentId
	 * @return
	 */
	public List<MerchantInfo> getBranch(String parentId, Date date);
	
	public Map<String, Object> getBranchMoney(String parentId, String date);
    /**
	 * 验证用户注册  手机号 是否存在
	 * @param telephone
	 * @return
	 */
	public boolean checkMerchantExistByTelephone(String telephone);
	
	/**
	 * 验证用户注册  手机号 证件号是否存在
	 * @param identityNo
	 * @return
	 */
	public boolean checkMerchantByIdentityNo(String identityNo);

	/**
	 * 查找所有数据列表
	 * 
	 * @return
	 * @throws DataAccessException
	 */
	public List<MerchantInfoModel> getAllList() throws DataAccessException;

	/**
	 * 根据单Key查找Model
	 * 
	 * @param key
	 * @return
	 * @throws DataAccessException
	 */
	public MerchantInfoModel getModelByKey(String key)
			throws DataAccessException;

	/**
    * 获得客商，证件，结算信息
    *
    * @param key
    * @return MerchantInfoDetailModel
    * @throws DataAccessException
    * @author baojun.liu
    */
    public MerchantInfoTodoTask transformMerchantDetailToTask(String key)
           throws DataAccessException;
	/**
	 * 根据客商信息Key，查找证件信息，终端信息，结算信息
	 * 
	 * @return
	 * @throws DataAccessException
	 */
	public MerchantInfoDetailModel getMerchantDetail(String key) throws DataAccessException;

	/**
	 * 根据Model查找列表
	 * 
	 * @param model
	 * @return
	 * @throws DataAccessException
	 */
	public List<MerchantInfoModel> getListByModel(MerchantInfoModel model)
			throws DataAccessException;

	/**
	 * 新增并返回主键
	 * 
	 * @param model
	 * @return
	 * @throws DataAccessException
	 */
	public String add(MerchantInfoModel model) throws DataAccessException, UnsupportedEncodingException;

	/**
	 * 更新并返回主键
	 * 
	 * @param model
	 * @throws DataAccessException
	 */
	public String update(MerchantInfoModel model) throws DataAccessException;

	/**
	 * 删除
	 *
	 * @param model
	 * @return
	 * @throws DataAccessException
	 */
	public void delete(MerchantInfoModel model) throws DataAccessException;

	/**
	 * 分页查询
	 * 
	 * @param pageSize
	 * @param pageNum
	 * @param domain
	 * @return
	 * @throws DataAccessException
	 */
	public Map getPageByDomain(MerchantInfoDomain domain,AgentInfoModel curAgentInfo) throws DataAccessException;

	/**
	 * 新增商户终端关联表
	 * @param merchantId
	 * @param terminalId
	 * @throws DataAccessException
	 */
	public void addMerchantTerminalInfo(String merchantId, String terminalId)
			throws DataAccessException;
	/**
	 * 新增商户证件信息关联表
	 * @param record
	 * @throws DataAccessException
	 */
	public void addMerchantCertificateInfo(MerchantCertificateInfo record)
			throws DataAccessException;
	/**
	 * 根据商户获得绑定的终端
	 */
	public List<TerminalInfoModel> getTerminalListByMerchantId(String merchantId) throws DataAccessException;
	/**
	 * 根据登录名查找对应的商户
	 * @param sysAccount
	 * @return
	 * @throws DataAccessException
	 */
	public MerchantInfoModel getMerchantInfoModelBySysAccount(String sysAccount)
			throws DataAccessException;
	/**
	 * 保存客商信息
	 * @param detail
	 * @return
	 * @throws DataAccessException
	 */
	public MerchantInfoModel saveDetail(MerchantInfoDetailModel detail)
			throws DataAccessException, UnsupportedEncodingException;
	/**
	 * 根据当前代理商id查找所有下级列表
	 */
	List<String> queryListMerchantIdByAgentInfo(AgentInfoModel model,MerchantInfoModel merchantInfoModel);
	/**
	 *  根据指定条件查询商户列表
	 */
	List<String> queryListMerchantIdByMerchantName(MerchantInfoModel merchantInfoModel);

	//查找符合条件的merchantId list集合
	List<String> queryMerchantIdListByAgentInfo(AgentInfoModel curAgentInfoModel,MerchantInfoModel merchantInfoModel);

	//查找MerchantInfo
	List<MerchantInfo> queryListMerchantInfoByAgentInfo(AgentInfoModel curAgentInfoModel,MerchantInfoModel merchantInfoModel);

	List<MerchantInfoModel> queryListMerchantInfoModelByAgentInfo(AgentInfoModel curAgentInfoModel,MerchantInfoModel merchantInfoModel);

	List<String> queryListMerchantIdByModel(MerchantInfoModel searchMerchantInfoModel);
	//商户转让
	Map<String,Object> transMerchant(TransAgentDomain transMerchant, AgentInfoModel curAgentInfoModel);
}
